using System.ComponentModel.DataAnnotations;

namespace UniversalAdmin.Application.DTOs;

public class RegisterDto
{
    //注册用户
    [Required(ErrorMessage = "用户名不能为空")]
    public string Username { get; set; } = string.Empty;

    //注册密码
    [Required(ErrorMessage = "密码不能为空")]
    [MinLength(8, ErrorMessage = "密码长度至少为8位")]
    [RegularExpression(@"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$", ErrorMessage = "密码必须至少8位,且包含字母和数字")]
    public string Password { get; set; } = string.Empty;

    //注册邮箱
    [Required(ErrorMessage = "邮箱不能为空")]
    [EmailAddress(ErrorMessage = "邮箱格式不正确")]
    public string Email { get; set; } = string.Empty;

    //注册手机号
    [Required(ErrorMessage = "手机号不能为空")]
    [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "手机号格式不正确")]
    public string Phone { get; set; } = string.Empty;

    //用于确认阅读了服务条款
    public bool TermsAccepted { get; set; } = false;
}